<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../resources/js-test.js"></script>
</head>
<body id="body">
<div role="textbox" aria-readonly="false" aria-multiline="false" id="ariaTextBox" tabindex="0"></div>
<div role="textbox" aria-readonly="true" id="ariaReadOnlyAriaTextBox" tabindex="0"></div>
<input type="text" aria-readonly="true" id="ariaReadOnlyTextField" size=20>
<input type="text" aria-readonly="false" id="ariaNonReadOnlyTextField" size=20>
<input type="text" readonly="readonly" id="htmlReadOnlyTextField" size=20>
<input type="text" id="textField" size=20>
<textarea rows="2" cols="20" readonly="readonly" id="htmlReadOnlyTextArea"></textarea>
<textarea rows="2" cols="20" id="textArea"></textarea>
<p id="description"></p>
<div id="console"></div>

<script>

    description("This tests that the AXValue property is correctly reported for native and non-native text boxes.");

    if (window.accessibilityController) {
          document.getElementById("ariaTextBox").focus();
          var ariaTextBox = accessibilityController.focusedElement;
          var ariaTextBoxIsWritable = ariaTextBox.isAttributeSettable("AXValue");
          shouldBe("ariaTextBoxIsWritable", "true");

          document.getElementById("ariaReadOnlyAriaTextBox").focus();
          var ariaReadOnlyAriaTextBox = accessibilityController.focusedElement;
          var ariaReadOnlyAriaTextBoxIsWritable = ariaReadOnlyAriaTextBox.isAttributeSettable("AXValue");
          shouldBe("ariaReadOnlyAriaTextBoxIsWritable", "false");

          document.getElementById("ariaReadOnlyTextField").focus();
          var ariaReadOnlyTextField = accessibilityController.focusedElement;
          var ariaReadOnlyTextFieldIsWritable = ariaReadOnlyTextField.isAttributeSettable("AXValue");
          shouldBe("ariaReadOnlyTextFieldIsWritable", "false");

          document.getElementById("ariaNonReadOnlyTextField").focus();
          var ariaNonReadOnlyTextField = accessibilityController.focusedElement;
          var ariaNonReadOnlyTextFieldIsWritable = ariaNonReadOnlyTextField.isAttributeSettable("AXValue");
          shouldBe("ariaNonReadOnlyTextFieldIsWritable", "true");

          document.getElementById("htmlReadOnlyTextField").focus();
          var htmlReadOnlyTextField = accessibilityController.focusedElement;
          var htmlReadOnlyTextFieldIsWritable = htmlReadOnlyTextField.isAttributeSettable("AXValue");
          shouldBe("htmlReadOnlyTextFieldIsWritable", "false");

          document.getElementById("textField").focus();
          var textField = accessibilityController.focusedElement;
          var textFieldIsWritable = textField.isAttributeSettable("AXValue");
          shouldBe("textFieldIsWritable", "true");

          document.getElementById("htmlReadOnlyTextArea").focus();
          var htmlReadOnlyTextArea = accessibilityController.focusedElement;
          var htmlReadOnlyTextAreaIsWritable = htmlReadOnlyTextArea.isAttributeSettable("AXValue");
          shouldBe("htmlReadOnlyTextAreaIsWritable", "false");

          document.getElementById("textArea").focus();
          var textArea = accessibilityController.focusedElement;
          var textAreaIsWritable = textArea.isAttributeSettable("AXValue");
          shouldBe("textAreaIsWritable", "true");
    }

</script>

</body>
</html>
